libxlu: introduce xlu_pci_parse_spec_string()
authorPaul Durrant <pdurrant@amazon.com>
Tue, 5 Jan 2021 17:46:37 +0000 (17:46 +0000)
committerWei Liu <wl@xen.org>
Thu, 21 Jan 2021 15:20:40 +0000 (15:20 +0000)
commitbdc0799fe26ab066f47fb026148aa93e95b262f6
tree8976758427bcc92c5cd2309e0a61271126a0fb2a
parentc0b8aba56c8664d3de1416096d26eb2a32b3ce43
libxlu: introduce xlu_pci_parse_spec_string()

This patch largely re-writes the code to parse a PCI_SPEC_STRING and enters
it via the newly introduced function. The new parser also deals with 'bdf'
and 'vslot' as non-positional paramaters, as per the documentation in
xl-pci-configuration(5).

The existing xlu_pci_parse_bdf() function remains, but now strictly parses
BDF values. Some existing callers of xlu_pci_parse_bdf() are
modified to call xlu_pci_parse_spec_string() as per the documentation in xl(1).

NOTE: Usage text in xl_cmdtable.c and error messages are also modified
      appropriately.
      As a side-effect this patch also fixes a bug where using '*' to specify
      all functions would lead to an assertion failure at the end of
      xlu_pci_parse_bdf().

Fixes: d25cc3ec93eb ("libxl: workaround gcc 10.2 maybe-uninitialized warning")
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Wei Liu <wl@xen.org>
tools/include/libxlutil.h
tools/libs/util/libxlu_pci.c
tools/xl/xl_cmdtable.c
tools/xl/xl_parse.c
tools/xl/xl_pci.c